package com.mezz.bones.im.common.enums;

import com.mezz.bones.im.common.message.content.*;

public enum ContentTypeEnum {
    TEXT("text", "文本消息", TextContent.class),
    AUDIO("audio", "音频消息", AudioContent.class),
    VIDEO("video", "视频消息", VideoContent.class),
    CUSTOM("custom", "自定义消息", CustomContent.class),
    IMAGE("image", "图片消息", ImageContent.class),
    FACE("face", "表情消息", ImageContent.class),
    FILE("file", "文件消息", ImageContent.class),



    ;
    private final String type;
    private final String description;

    private final Class clazz;

    ContentTypeEnum(String type, String description, Class clazz) {
        this.type = type;
        this.description = description;
        this.clazz = clazz;
    }

    public String getType() {
        return type;
    }

    public String getDescription() {
        return description;
    }

    public Class getClazz() {
        return clazz;
    }

    public static ContentTypeEnum findEnum(String type){

        for (ContentTypeEnum value : ContentTypeEnum.values()) {

            if (value.getType().equals(type)) {
                return value;
            }
        }

        return null;
    }

    @Override
    public String toString() {
        return this.name() + " (" + description + ")";
    }
}

